<% if @application_token.errors.any? %>
  $('#float-alert p').html("<%= escape_javascript(@application_token.errors.full_messages.join('<br/>')) %>");
  $('#float-alert').fadeIn(setTimeOutAlertDelay());
<% else %>
  $("<%= escape_javascript(render @application_token) %>").appendTo("#application_tokens");
  $('#float-alert p').html("Token <code><%= @plain_token %></code> was created successfully");
  $('#float-alert').fadeIn();
  $('#add_application_token_btn i').removeClass("fa-minus-circle");
  $('#add_application_token_btn i').addClass("fa-plus-circle");
  $('#add_application_token_form').fadeOut();
  $('#application_token_application').val("")
  <% if current_user.application_tokens.count >= User::APPLICATION_TOKENS_MAX %>
    $('#add_application_token_btn').attr("disabled", "disabled");
  <% end %>
<% end %>
